package com.jiuhaohealth.kangxun360.main.po;

import com.jiuhaohealth.base.superpage.BeanSuper;
import com.jiuhaohealth.common.table.TableChooser;

public class Account extends AccountKey implements BeanSuper {
    private String email;

    private String firstname;

    private String lastname;

    private String status;

    private String addr1;

    private String addr2;

    private String city;

    private String state;

    private String zip;

    private String country;

    private String phone;

    protected String table = "t_account";

    protected String tableOffset = "";

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname == null ? null : firstname.trim();
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname == null ? null : lastname.trim();
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public String getAddr1() {
        return addr1;
    }

    public void setAddr1(String addr1) {
        this.addr1 = addr1 == null ? null : addr1.trim();
    }

    public String getAddr2() {
        return addr2;
    }

    public void setAddr2(String addr2) {
        this.addr2 = addr2 == null ? null : addr2.trim();
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city == null ? null : city.trim();
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state == null ? null : state.trim();
    }

    public String getZip() {
        return zip;
    }

    public void setZip(String zip) {
        this.zip = zip == null ? null : zip.trim();
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country == null ? null : country.trim();
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    /** 
     * 拷贝，将对象中的字段全部拷贝到子对象中
     * @param bean 接收对象的子类
     * @return 拷贝完成后的子类
     */ 
    public  <T extends Account> T copy(T bean) {
        bean.setId(getId());
        bean.setUserid(getUserid());
        bean.setEmail(getEmail());
        bean.setFirstname(getFirstname());
        bean.setLastname(getLastname());
        bean.setStatus(getStatus());
        bean.setAddr1(getAddr1());
        bean.setAddr2(getAddr2());
        bean.setCity(getCity());
        bean.setState(getState());
        bean.setZip(getZip());
        bean.setCountry(getCountry());
        bean.setPhone(getPhone());
        return bean;
    }

    /** 
     * 格式化显示
     */ 
    @Override
    public String toString() {
        return "{" + 
        	", id:" + getId() + 
        	", userid:" + getUserid() + 
        	", email:" + getEmail() + 
        	", firstname:" + getFirstname() + 
        	", lastname:" + getLastname() + 
        	", status:" + getStatus() + 
        	", addr1:" + getAddr1() + 
        	", addr2:" + getAddr2() + 
        	", city:" + getCity() + 
        	", state:" + getState() + 
        	", zip:" + getZip() + 
        	", country:" + getCountry() + 
        	", phone:" + getPhone() + 
        "}";
    }

    /**
     * 设置表名
     * @param table 设置表名
     */
    public void setTable(String table) {
        this.table=table;
    }

    public String getTable() {
        return table;
    }

    /**
     * 设置分表的下标
     * @param tableOffset 设置分表的下标
     */
    public void setTableOffset(String tableOffset) {
        this.tableOffset=tableOffset;
        if(!tableOffset.equals(""))
        	this.table+=tableOffset;
    }

    public String getTableOffset() {
        return tableOffset;
    }

    /**
     * 根据分表选择器选择分表下标
     * @param DataSourceChooser chooser 
     */
    public void setTableOffset(TableChooser chooser) {
        String offset=chooser.choose();
        this.tableOffset=offset;
        if(!offset.equals(""))
        	this.table+=offset;
    }
}